<template>
  <div>
    <h2>显示</h2>
    用户名称<input type="text" v-model="sdata.U_Name" /> 投资项目总金额:<input
      type="date"
      v-model="sdata.max"
    />--<input type="date" v-model="sdata.min" />
    <input type="button" value="查询" @click="Show()" />
    <table class="table table-bordered">
      <thead>
        <tr>
          <td>用户名称</td>
          <td>用户投资金额</td>
          <td>投资时间</td>
        </tr>
      </thead>
      <tbody>
        <tr v-for="a in list">
          <td>{{ a.U_Name }}</td>
          <td>{{ a.UT_Money }}</td>
          <td>{{ a.UT_Date.substring(0, 10) }}</td>
        </tr>
      </tbody>
    </table>
    <span>
      总条数:,<b style="color: red">{{ count }}</b>
    </span>
  </div>
</template>

<script setup lang="ts">
import { reactive, toRefs, onMounted } from 'vue';
import axios from 'axios';
import { useRoute, useRouter } from 'vue-router';
let router = useRouter();
let route = useRoute();

let data: any = reactive({
  sdata: {
    U_Name: '',
    max: '',
    min: '',
    T_Id: route.query.T_Id
  },
  list: {},
  count: 0
});
let { sdata, list, count } = toRefs(data);

onMounted(() => {
  Show();
});

const Show = () => {
  axios({
    url: 'http://localhost:53547/api/User/zuiho',
    method: 'get',
    params: sdata.value
  }).then((res) => {
    console.log(res);
    list.value = res.data.data.plist;
    count.value = res.data.data.count;
  });
};
</script>

<style scoped></style>
